<template>
  <el-form ref="formRef" :model="formModel" :rules="rules" label-width="130px" class="dialog-form" label-position="right" status-icon>
    <el-form-item label="优惠券编码:" v-if="showType === '2'">
      <el-input class="form-item" v-model="formModel.couponCode" disabled clearable />
    </el-form-item>
    <el-form-item label="优惠券批次号:" v-if="showType === '3'">
      <el-input class="form-item" v-model="formModel.batchNo" placeholder="请输入优惠券批次号" clearable />
    </el-form-item>
    <el-form-item label="手机号码:">
      <el-input type="textarea" :rows="4" class="form-item" v-model="formModel.curPhone" :placeholder="placeholder" clearable />
    </el-form-item>
  </el-form>
</template>

<script>
import MixinForm from 'mixins/form'

export default {
  mixins: [MixinForm],
  props: {
    showType: {
      type: String,
      default: '2'
    },
    initData: {
      type: Object,
      default() {
        return {
          // TODO... 初始化数据，需加备注
        }
      }
    }
  },
  data(vm) {
    return {
      placeholder: vm.showType === '3' ? '请输入手机号，多个用逗号,分割' : '请输入手机号',
      rules: {}
    }
  },
  computed: {
    formModel: {
      get() {
        return this.initData
      },
      set(val) {
        this.$emit('update:init-data', val)
      }
    }
  }
}
</script>
